//
//  OrgTableViewCell.m
//  EPBPro
//
//  Created by wucha on 2018/6/29.
//  Copyright © 2018年 fc. All rights reserved.
//

#import "OrgTableViewCell.h"

@interface OrgTableViewCell()
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic,strong) UIButton *addressButton;

@end

@implementation OrgTableViewCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = 0;
        UILabel *titleLabel = [UILabel new];
        titleLabel.font = [UIFont systemFontOfSize:16];
        [self.contentView addSubview:titleLabel];
        self.titleLabel = titleLabel;
        titleLabel.sd_layout.leftSpaceToView(self.contentView, 10).topSpaceToView(self.contentView, 10).widthIs(SCREEN_WIDTH-20).heightIs(20);
        
        UIButton *addressButton = [UIButton new];
        addressButton.titleLabel.font = [UIFont systemFontOfSize:14];
//        addressLabel.font = [UIFont systemFontOfSize:14];
        [addressButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        addressButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        [self.contentView addSubview:addressButton];
        self.addressButton = addressButton;
        addressButton.sd_layout.leftSpaceToView(self.contentView, 10).topSpaceToView(titleLabel, 10).widthIs(SCREEN_WIDTH-20).heightIs(14);
    }
    
    return self;
    
}



-(void)setOrgInfoCell:(OrgInfo*)orgInfo{
    self.titleLabel.text = orgInfo.name;
    NSString *addressString = [NSString stringWithFormat:@"%@%@%@",orgInfo.city,orgInfo.area,orgInfo.address];
    [self.addressButton setTitle:addressString forState:UIControlStateNormal];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
